/** @format */

import request from '@/utils/request'

/**
 * 获取文章列表
 */
export function getArticleListApi(query) {
	return request({
		method: 'get',
		url: '/article',
		params: query
	})
}

/**
 * 删除文章
 */
export function delArticleApi(articleId) {
	return request({
		method: 'delete',
		url: `/article/${articleId}`
	})
}

/**
 * 获取文章详情
 */
export function getArticleDetailApi(articleId) {
	return request({
		method: 'get',
		url: `/article/${articleId}`
	})
}

/**
 * 新增文章
 */
export function postArticleApi(articleForm) {
	return request({
		method: 'post',
		url: '/article',
		data: articleForm
	})
}

/**
 * 编辑文章
 */
export function putArticleApi(articleForm) {
	return request({
		method: 'put',
		url: `/article/${articleForm.id}`,
		data: articleForm
	})
}
